{extend name="common:base"/}
{block name="body"}
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-12">
        <h2>系统</h2>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>{present name="info"}编辑{else /}新增{/present}行为</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content p-xl-important">
                    <form class="form-horizontal" id="signupForm" method="post" action="{:\\think\\Url::build('renew')}" >
                        <div class="form-group ">
                            <label class=" control-label">行为标识<span class="check-tips">(输入行为标识 英文字母)</span></label>
                            <input id="url" class="form-control input-large" type="text" name="name" value="{$info.name|default=''}">
                        </div>
                        <div class="form-group ">
                            <label class=" control-label">行为名称<span class="check-tips">(输入行为名称)</span></label>
                            <input id="title" class="form-control input-large" type="text" name="title" value="{$info.title|default=''}">
                        </div>
                        <div class="form-group input-large">
                            <label class="control-label">行为类型<span class="check-tips">(选择行为类型)</span></label>
                             <select class="form-control input-small" name="type">
                                {volist name=":get_action_type(null,true)" id="vo"}
                                <option value="{$key}">{$vo}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group ">
                            <label class="control-label">行为描述：<span class="check-tips">(输入行为描述)</span></label>
                            <textarea name="remark" class="form-control input-large" rows="4">{$info.remark|default=''}</textarea>
                        </div>
                        
                        <div class="form-group ">
                            <label class="control-label">行为规则：<span class="check-tips">(输入行为规则，不写则只记录日志)</span></label>
                            <textarea name="rule" class="form-control input-large" rows="4">{$info.rule|default=''}</textarea>
                        </div>
                        <div class="form-group ">
                            <label class="control-label">日志规则：<span class="check-tips">(记录日志备注时按此规则来生成，支持[变量|函数]。目前变量有：user,time,model,record,data)</span></label>
                            <textarea name="log" class="form-control input-large" rows="4">{$info.log|default=''}</textarea>
                        </div>
                        <div class="form-group">
                            <input type="hidden" name="id" value="{$info.id|default=''}">
                            <button class="btn btn-w-m btn-primary" target-form="form-horizontal" type="submit">提交</button>
                            <button class="btn btn-w-m btn-default retreat">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

</div>
{/block}

{block name="script"}
<!-- 选择js 加载-->
<script type="text/javascript" src="__JS__/detail.js"></script>
<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
<script type="text/javascript">
    $(function () {
        highlight_subnav("{:\\think\\Url::build('Action/index')}");
        static7.setChoose("type", "{$info.type|default=1}");
        $("#signupForm").validate({
            rules: {
                name: {
                    required: true,
                    minlength: 2
                },
                title: "required",
                remark: "required",
            },
            messages: {
                name: {
                    required: '行为标识不能为空',
                    minlength: '至少两个字符以上'
                },
                title: {
                    required: "行为标题不能为空"
                },
                remark: {
                    required: "行为描述不能为空"
                }
            },
            submitHandler: function () {
                validateAjax("#signupForm", "button[type='submit']");
                return false;
            }
        });
    });
</script>
{/block}